/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package me.send.broker.mapper.provider;

import java.util.Map;

/**
 * @author maxmin
 *
 * @date 2015年9月28日 下午6:19:53
 */
public class OrderProvider {
	
	public String purchased(Map<String, Object> params){
		StringBuffer sb = new StringBuffer();
		int status = (Integer)params.get("status");
		int preStatus = (Integer)params.get("preStatus");
		int popid = (Integer)params.get("popid");
		int advertId = (Integer)params.get("advertId");
		int adverttype = (Integer)params.get("adverttype");
		double fee = (Double)params.get("fee");
		int orderid = (Integer)params.get("orderid");
		String createtime = (String)params.get("createtime");
		sb.append("UPDATE orders SET status =").append(status);
		sb.append(",brokerid=").append(popid);
		if (advertId==0) {
			sb.append(",fee=").append(fee);
		}else {
			if (adverttype==3) {
				sb.append(",fee=").append(fee);
			}
		}
		sb.append(",updatetime='").append(createtime).append("' WHERE ");
		sb.append(" orderid=").append(orderid).append(" AND status=").append(preStatus);
		return sb.toString();
	}
}
